The invention relates to a computer system with a debug facility for watching a selected register or registers.
The invention is applicable to high performance digital processors including those with on-chip debug facilities. Such processors may operate with pipelined execution of instruction sequences in one or more parallel execution units together with prediction guard values associated with instructions so that execution depends on resolution of the guard value. The debug operation may be effected by emulation circuitry, which may be on chip, and may be arranged to observe changes occurring in internal architectural registers of the processor.
Systems have been proposed in which identified registers are watched by the provision of physical wires to allow the values in the registers and any changes in those values to be monitored by emulation circuitry to which the physical wires are connected. This may however produce routing congestion and does require additional hardware. It may not be suited to high speed digital processors.
It is an object of the present invention to provide an improved computer system and method of operating a computer system in which specified registers may be watched during execution of one or more instruction sequences.
The invention provides a computer system for executing a sequence of instructions and effecting changes in data held in one or more registers during execution of the instructions, which computer system includes instruction fetch circuitry, decode circuitry to decode instructions and identify any registers to be used in execution of the instruction, and dispatch circuitry to dispatch instructions to one or more execution units after decoding, said computer system including emulator circuitry for debug operations which emulator circuitry is arranged to watch data values in one or more selected registers modified during execution of the instructions, which computer circuitry further comprises a register watch store for identifying one or more registers to be watched, comparator circuitry for comparing registers identified by said decode circuitry with registers identified in said register watch store and providing a hit signal for hits in the comparison, and instruction insertion circuitry responsive to hit signals to insert in the instruction sequence to an execution unit a store instruction to store in a location accessible by the emulation circuitry the data value in a data register identified by a hit signal after execution of the instruction using the data register.
Preferably the register watch store is responsive to the emulator circuitry to select which registers are identified in the register watch store.
Preferably the emulator circuitry includes program count watch circuitry for watching fetch addresses supplied to a program memory and providing a program count indication for any selected instruction supplied to an execution unit.
Preferably a plurality of parallel execution units are provided and said comparator circuitry is arranged to identify which execution unit will receive any instruction providing a hit signal.
Preferably the instruction fetch circuitry is arranged to fetch more than one instruction in each fetch operation, the instructions being supplied in parallel to respective execution units and said comparator circuitry being operable to identify hit signals for more than one parallel instruction.
Preferably the or each execution unit comprises a pipelined execution unit.
Preferably the register watch store comprises a plurality of registers each identifying a respective data register usable in execution of an instruction, said emulator circuitry being operable to identify in said plurality of registers which data registers are to be watched.
Preferably said comparator circuitry is operable to compare the output of said decode circuitry with said plurality of registers and to set values in a hit signal store where register hits are found in said comparison.
Preferably said instruction insertion circuitry is arranged to insert a store instruction in each instruction sequence immediately after any instruction which is decoded and provides said hit signal.
Preferably the store instruction inserted in the instruction sequence is arranged to store the data register value in a store location determined by the emulator circuitry.
Preferably the computer system comprises a single integrated circuit chip device and said emulator circuitry is located on the same chip.
The invention includes a method of executing a sequence of instructions in a computer system and effecting changes in data held in one or more registers during execution of the instructions, which method comprises fetching a sequence of instructions from a program memory, decoding fetched instructions and identifying any registers to be used on execution of each instruction, dispatching decoded instructions to one or more execution units after decoding and executing said instructions, said method further comprising operating emulator circuitry for a debug operation by identifying one or more registers to be watched during instruction execution, comparing said identified registers with registers indicated during decoding of instructions to be executed and forming a hit signal where execution of any instruction will use a register corresponding to an identified register to be watched, and in response to said hit signal inserting a store instruction in the instruction sequence to be supplied to the execution unit so as to store the data value put into the identified register in a store accessible to the emulator circuitry.
Preferably instructions are fed in parallel to a plurality of parallel execution units.
Preferably the or each execution unit executes instructions in a pipelined operation.
Preferably each instruction in the instruction sequence includes a guard or prediction value to be determined on execution of the instruction, said inserted store instruction having a guard value which confirms that the store instruction will be executed.